<!-- 个人记录新增-->
<template>
    <view class="mainPge">
        <!-- 公共头部 -->
        <headerPublic title="个人记录" @backfn="backfn"/>
        <!--主体-->
        <view class="page-content outbottom">
            <view class="frct">
                <view class="fr-colum">
                    <view class="fr-lable">
                        <text class="redico">*</text>
                        记录标题：
                    </view>
                    <uv-input v-model="pageInfo.title" placeholder="请输入记录标题" border="bottom" class="textleft"></uv-input>
                </view>
            </view>
            <view class="frct">
                <view class="fr-colum">
                    <view class="fr-lable">
                        <text class="redico">*</text>
                        正文：
                    </view>
                    <uv-textarea v-model="pageInfo.text" placeholder="请输入会议内容" :maxlength="-1" autoHeight  style="margin-bottom: 10px"></uv-textarea>
                </view>
            </view>
            
        </view>
		<!--底部固定 -->
		<view class="bt-foot">
			<view class="bt bt2" style="margin: 0 15px;flex: 1;" @click="sumitFn()">提交</view>
		</view>
       
    </view>
</template>
<script>
import { savetWorklog,getWorklogInfo} from '@/api/worklog.js';
export default {
    name: 'noticeset',
    data() {
        return {
            pageInfo:{
            	title: '',// 记录标题
            	text: '',// 正文
				pageId:'',//页面传过来的id，没有就是新增有就是编辑
            },
			pagetype:'',//判断是新增还是编辑
			
        };
    },
	onLoad(res) {
		this.pageInfo.pageId = res && res.id ? res.id :''
		if(res && res.pagetype=='edit'){
			getWorklogInfo(this.pageInfo.pageId).then(res =>{
				this.pageInfo = res.data
			})
		}
	},
    methods: {
        // 提交
		sumitFn(){
			if(this.pageInfo.text =="" || this.pageInfo.title==""){
				uni.showToast({
				    title: '请先填写必填项！',
				    icon: 'none',
				    duration: 1500
				});
				return
			}
			savetWorklog(this.pageInfo).then(res=>{
				uni.navigateTo({
				    url: '/documentManagement/worklog/list'
				});
			})
		},
		backfn(){
			uni.navigateBack({
				data: 1
			});
		},
    }
};
</script>
<style scoped lang="scss">
@import '../../style/documentmanage.scss';
</style>
